package cn.yhp.chatgpt.data.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author yhp
 * @description
 * @date 2024/1/16
 */
@ConfigurationProperties(prefix = "thread.pool.executor.config",ignoreInvalidFields = true)
@Data
public class ThreadPoolConfigProperties {
    /*核心线程数*/
    private Integer corePoolSize=20;
    private Integer maxPoolSize=200;
    private Long keepAliveTime=10L;
    private Integer blockQueueSize=5000;

    /**
     * 拒绝策略：
     * AbortPolicy：抛弃任务，并抛出异常
     * DiscardPolicy：抛弃任务，不抛出异常
     * DiscardOldestPolicy：将最早进入队列的任务丢弃，后在尝试执行新任务
     * CallerRunsPolicy：如果任务添加队列失败，主线程执行该任务
     */
    private String policy="AbortPolicy";
}
